package com.edu.handler;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class Loghandler implements InvocationHandler {
    private Object object;

    public Loghandler(Object object){
        this.object = object;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        long start = System.currentTimeMillis();
        Object result = method.invoke(object,args);
        long end = System.currentTimeMillis();
        System.out.println("耗时"+(end-start));
        return result;
    }
}
